package com.foreveross.crawl.common.domain;

import java.io.Serializable;

import com.foreveross.crawl.common.InstanceFactory;
import com.foreveross.crawl.common.jpa.IBaseRepository;

public abstract class BaseJdbcEntity implements IBaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3576276732228997179L;
	private Serializable id;

	@Override
	public Serializable getId() {
		return id;
	}

	@Override
	public void setId(Serializable id) {
		this.id = id;
	}

	@Override
	public IBaseRepository getBaseEntityRepository() {
		return (IBaseRepository)InstanceFactory.getInstance("entityJdbcRepository");
	}
	/**
	 * 创建实体
	 * @param o
	 */
	public void create(){
		getBaseEntityRepository().create(this);
	}

	/**
	 * 更新实体
	 * @param o 实体对象
	 */
	public void update(){
		getBaseEntityRepository().update(this);
	}

	/**
	 * 删除实体对象
	 * @param o
	 */
	public void delete(){
		getBaseEntityRepository().delete(this);
	}
}
